<script>
  const sleep = ms => new Promise(resolve => setTimeout(resolve, ms))

  const game = () => {
    console.log('游戏开始')

    sleep(500)
      .then(() => {
        console.log('游戏进行中')
        return sleep(1000)
      })
      .then(() => {
        console.log('游戏进行中')
        return sleep(1000)
      })
      .then(() => {
        console.log('游戏进行中')
        return sleep(1000)
      })
      .then(() => {
        console.log('游戏结束')
      })
      .catch(error => {
        console.error('游戏出错:', error)
      })
  }

  game()
</script>
